<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../lib/layui/css/layui.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/max-width768.css" media="screen and (max-width: 768px)">
    <link rel="stylesheet" href="../css/max-width992.css" media="screen and (max-width: 992px) and (min-width: 769px)">
    <link rel="stylesheet" href="../css/max-width1200.css" media="screen and (max-width: 1200px) and (min-width: 993px)">
    <link rel="stylesheet" href="../lib/layui-extend/formSelects/formSelects-v4.css">
    <script src="https://use.fontawesome.com/99addf19a5.js"></script>
</head>
<body>
    <div class="dream-head">
        <div class="dream-head-logo pull-left">
            个人博客后台
        </div>
        <div class="dream-head-menu">
            <ul class="affair">
                <li class="user-info dream-open">
                    <div class="show">
                        <img src="http://adminlte.la998.com/dist/img/user2-160x160.jpg">
                        <span>cxcsz</span>
                    </div>
                    <div class="info-list">
                        <div class="info-head">
                            <div class="portrait">
                                <img src="http://adminlte.la998.com/dist/img/user2-160x160.jpg">
                            </div>
                            <div class="name">
                                cxcsz
                            </div>
                            <div class="info">
                                职位：系统管理员
                            </div>
                            <div class="info">
                                最后登录时间：2018.11.13
                            </div>
                            <div class="info">
                                最后登录ip：127.0.0.1
                            </div>
                        </div>
                        <div class="info-body">
                            <div class="operation">
                                <button onclick="alert('你好')" class="layui-btn layui-btn-primary layui-btn-sm pull-left">迷你按钮</button>
                                <button class="layui-btn layui-btn-primary layui-btn-sm pull-right">迷你按钮</button>
                                <div class="layui-clear"></div>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="dream-body">
        <div class="dream-slider">
            <div class="user-info">
                <div class="img">
                    <img src="http://adminlte.la998.com/dist/img/user2-160x160.jpg">
                </div>
                <div class="info">
                    <div class="info-name">cxcsz</div>
                    <div class="info-state">
                        <span class="layui-badge-dot layui-bg-green"></span>
                        在线
                    </div>
                </div>
                <div class="layui-clear"></div>
            </div>
            <div class="dream-menu">
                <ul>

                </ul>
            </div>
        </div>
        <div class="dream-main">
            <div class="dream-crumbs">
                <a href="#">首页</a>
                <span>></span>
                <a href="#">菜单</a>
                <span>></span>
                <a href="#">栏目</a>
                <span>></span>
                <a href="#">文字</a>
                <span>></span>
                <a href="#">导航</a>
            </div>
            <div class="layui-fluid dream-content">
                <div class="layui-row">
                    <form class="layui-form layui-form-pane" action="">
                        <div class="layui-form-item">
                            <label class="layui-form-label">输入框</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">密码框</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">辅助文字</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">普通选择框</label>
                            <div class="layui-input-block">
                                <select name="city" lay-verify="required">
                                    <option value=""></option>
                                    <option value="0">北京</option>
                                    <option value="1">上海</option>
                                    <option value="2" disabled>广州</option>
                                    <option value="3">深圳</option>
                                    <option value="4" selected>杭州</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">分组选择框</label>
                            <div class="layui-input-block">
                                <select name="quiz">
                                    <option value="">请选择</option>
                                    <optgroup label="城市记忆">
                                        <option value="你工作的第一个城市">你工作的第一个城市？</option>
                                    </optgroup>
                                    <optgroup label="学生时代">
                                        <option value="你的工号">你的工号？</option>
                                        <option value="你最喜欢的老师">你最喜欢的老师？</option>
                                    </optgroup>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">可搜索选择框</label>
                            <div class="layui-input-block">
                                <select name="city" lay-verify="" lay-search>
                                    <option value="010">layer</option>
                                    <option value="021">form</option>
                                    <option value="0571" selected>layim</option>
                                </select>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">复选框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="like[write]" title="写作">
                                <input type="checkbox" name="like[read]" title="阅读" checked>
                                <input type="checkbox" name="like[dai]" title="发呆">
                                <input type="checkbox" name="like[jin]" title="禁用" disabled>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">普通复选框</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="" title="写作" lay-skin="primary" checked>
                                <input type="checkbox" name="" title="发呆" lay-skin="primary">
                                <input type="checkbox" name="" title="禁用" lay-skin="primary" disabled>
                            </div>
                        </div>




                        <div class="layui-form-item">
                            <label class="layui-form-label">开关</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="switch" lay-skin="switch" value="设置后返回这个值否则是on">
                                <input type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked>
                                <input type="checkbox" name="zzz" lay-skin="switch" lay-text="开启|关闭">
                                <input type="checkbox" name="aaa" lay-skin="switch" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">单选框</label>
                            <div class="layui-input-block">
                                <input type="radio" name="sex" value="男" title="男" value="设置后返回这个值否则是on">
                                <input type="radio" name="sex" value="女" title="女" checked>
                                <input type="radio" name="sex" value="" title="中性" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">行内标签</label>
                            <div class="layui-input-block">
                                <div class="layui-inline">
                                    <label class="layui-form-label">范围</label>
                                    <div class="layui-input-inline" style="width: 100px;">
                                        <input type="text" name="price_min" placeholder="￥" autocomplete="off" class="layui-input">
                                    </div>
                                    <div class="layui-form-mid">-</div>
                                    <div class="layui-input-inline" style="width: 100px;">
                                        <input type="text" name="price_max" placeholder="￥" autocomplete="off" class="layui-input">
                                    </div>
                                </div>

                                <div class="layui-inline">
                                    <label class="layui-form-label">密码</label>
                                    <div class="layui-input-inline" style="width: 100px;">
                                        <input type="password" name="" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">tree选择</label>
                            <div class="layui-input-block">
                                <input type="text" id="tree" lay-filter="tree" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">多选</label>
                            <div class="layui-input-block">
                                <select name="city" xm-select="select1">
                                    <option value="1" disabled>北京</option>
                                    <option value="2" selected disabled>上海</option>
                                    <option value="3">广州</option>
                                    <option value="4" selected>深圳</option>
                                    <option value="5">天津</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">分组多选</label>
                            <div class="layui-input-block">
                                <select name="city" xm-select="select2">
                                    <optgroup label="分组1">
                                        <option value="1" disabled>北京</option>
                                        <option value="2" selected>上海</option>
                                    </optgroup>
                                    <optgroup label="分组2">
                                        <option value="3">广州</option>
                                        <option value="4" selected>深圳</option>
                                        <option value="5">天津</option>
                                    </optgroup>
                                </select>
                            </div>
                        </div>


                        <div class="layui-form-item">
                            <label class="layui-form-label">搜索创建</label>
                            <div class="layui-input-block">
                                <select name="city" xm-select="select3" xm-select-search xm-select-create>
                                    <option value="">值为空表示tips</option>

                                    <option value="1" disabled>北京</option>
                                    <option value="2" >上海</option>
                                    <option value="3">广州</option>
                                    <option value="4" selected>深圳</option>
                                    <option value="5">天津</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">文本域</label>
                            <div class="layui-input-block">
                                <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">laymd</label>
                            <div class="layui-input-block">
                                <div class="dome"></div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
            </div>
            <div class="dream-footer">
                © CXCSZ - 底部固定区域
            </div>
        </div>
    </div>

    <div id="menu-li" style="display: none">
        <li>
            <a href="index.html">
                <i class="fa fa-dashboard"></i>
                首页
            </a>
        </li>
        <li class="dream-show">
            <a href="index.html">
                <i class="fa fa-dashboard"></i>
                一级栏目
            </a>
        </li>
        <li class="dream-show dream-active">
            <a href="index.html">
                <i class="fa fa-dashboard"></i>
                一栏目 展开
                <span class="pull-right">
                              <i class="fa fa-angle-left pull-right"></i>
                            </span>
            </a>
            <ul>
                <li class="dream-show">
                    <a href="index.html">
                        <i class="fa fa-dashboard"></i>
                        二级栏目
                        <span class="pull-right">
                                      <i class="fa fa-angle-left pull-right"></i>
                                    </span>
                    </a>
                    <ul>
                        <li class="dream-show">
                            <a href="index.html">
                                <i class="fa fa-dashboard"></i>
                                三级栏目
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </li>
    </div>
    <script src="../lib/layui-extend/laymd/marked.min.js"></script>
    <script src="../lib/layui/layui.js"></script>
    <script>
        layui.extend({
            dream: '{/}../js/dream' // {/}的意思即代表采用自有路径，即不跟随 base 路径
        });
        layui.use(['jquery', 'dream'],function(){
            var $ = layui.jquery,
                dream = layui.dream;

            // window.onresize = function () {
                // if ($(window).width() < 720) {
                //     // $('.dream-slider').animate({"width":"0px"},"show");
                //     $('.dream-slider').css('display','none');
                // } else {
                //     // $('.dream-slider').animate({"width":"220px"},"show");
                //     $('.dream-slider').css('display','block');
                // }
            // }
        });
    </script>

    <script>
        layui.config({base: '../lib/layui-extend/'}).extend({'laymd':'laymd/laymd','formSelects':'formSelects/formSelects-v4'}).use(['laymd', 'jquery', 'form', 'treeSelect', 'formSelects'], function(){
            var laymd = layui.laymd,
                $   =   layui.jquery,
                form  = layui.form,
                treeSelect= layui.treeSelect,
                formSelects = layui.formSelects;

            //监听提交 表单
            form.on('submit(formDemo)', function(data){
                layer.msg(JSON.stringify(data.field));
                return false;
            });




            
            // makedown
            //实例化编辑器,可以多个实例
            //改用css选择器,去除init冗余
            var md = laymd('.dome', {});

            //内容改变事件
            md.on('change', function () {
                //这里借用marked.js解析效率比HyperDown快,用户可自行找解析器
                this.setPreview(marked(this.getText()));
            });

            $('#tijiao').click(function(){
                console.log(md.getText()); // md 文档
                console.log(marked(md.getText())); // html 文档
            });
            //初始化数据预览
            // console.log(md.do('change'));

            // formSelects
            // 启用多选 单个
            formSelects.undisabled('select1');
            // 启用多选 所有
            formSelects.undisabled();

            // treeSelect
            treeSelect.render({
                // 选择器
                elem: '#tree',
                // 数据
                data: '../data/data3.json',
                // 异步加载方式：get/post，默认get
                type: 'get',
                // 占位符
                placeholder: '修改默认提示信息',
                // 是否开启搜索功能：true/false，默认false
                search: true,
                // 点击回调
                click: function(d){
                    console.log(d);
                },
                // 加载完成后的回调函数
                success: function (d) {
                    console.log(d);
//                选中节点，根据id筛选
                    treeSelect.checkNode('tree', 3);

                    console.log($('#tree').val());

//                获取zTree对象，可以调用zTree方法
//                var treeObj = treeSelect.zTree('tree');
//                console.log(treeObj);

//                刷新树结构
//                treeSelect.refresh('tree');
                }
            });



        });
    </script>



</body>
</html>
